/*
 * Copyright (C) 2018 xuexiangjys(xuexiangjys@163.com)
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *       http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.xuexiang.xdlink.core;

import com.xuexiang.xdlink.component.channel.IChannel;
import com.xuexiang.xdlink.component.command.IProtocolCommand;

/**
 * 设备连接的监听接口
 *
 * @author xuexiang
 * @since 2018/8/23 下午11:18
 */
public interface OnDeviceConnectListener {

    /**
     * 通信通道连接状态改变监听【通信通道产生的事件】
     *
     * @param channel 设备连接者
     * @return 设备状态发生改变，需要协议向下位机发送的指令，如果返回null就不需要发送指令
     */
    IProtocolCommand onChannelConnectStatusChanged(IChannel channel);


    /**
     * 设备连接超时监听【由设备监控器IMonitor监听产生】
     *
     * @param deviceConnectCenter 设备连接中心
     */
    void onDeviceTimeout(IDeviceConnectCenter deviceConnectCenter);


}
